package com.blog.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @author jiafujun
 * 2020-05-13 17:07:45
 **/
@Controller
@RequestMapping("/blog")
public class BlogController {

    @RequestMapping("/index")
    public String index(HttpServletRequest request) {
        request.setAttribute("titleName","博客");
        return "index";
    }

    @RequestMapping("/single/{id}")
    public String single(HttpServletRequest request, @PathVariable Integer id) {
        request.setAttribute("articleId",id);
        request.setAttribute("titleName","博客");
        return "single";
    }

    @RequestMapping("/ad/login")
    public String login(){
        return "user/login";
    }

    @RequestMapping("/about")
    public String about(HttpServletRequest request){
        request.setAttribute("titleName","博客-关于");
        return "about";
    }

    @RequestMapping("/designer")
    public String designer(HttpServletRequest request){
        request.setAttribute("titleName","博客-数据库设计工具");
        return "designer";
    }
    @RequestMapping("/designerInfo")
    public String designerInfo(){
        return "designer-info";
    }
}
